import React, { FC, useEffect, useState } from 'react';
import ReactEcharts from 'echarts-for-react';

const BIn:FC<{data:{label:string,value:number}[]}> = (
    {
        data
    }
) => {
    
    data.sort((a,b)=>b.value -a.value)
    const getOption = () => {
        return {
            title: {
                text: '角色数量分析',
            },
            tooltip: {},
            xAxis: {
                data: data.map(item=>item.label),
            },
            yAxis: {},
            series: [
                {
                    name: '人数',
                    type: 'bar',
                    data: data.map(item=>item.value),
                },
            ],
        };
    };

    return (
    <ReactEcharts option={getOption()} />

    )
}
export default BIn